package com.zzx.Tes;

/**
 * @Author: zzx
 * @Date: 2025/7/1 15:28
 */
public class TTT {


    //1-2
    //2-3
    //3-7
    //4-15
    //5-31
    //6-63
    private static int calNodes(int level,int childNumber){
        double pow = Math.pow(level, childNumber)-1;
        return (int)pow;
    }



    private static void printTree(int total,int childNumber){
        for (int i = 1; i <= total; i++) {
            if (i==1) {
                //根节点
                System.out.println(i+"(父节点：无)");
            }else{
                int p = (i-2)/childNumber+ 1;
                System.out.println(i+"(父节点："+p+")");
            }
        }
    }

    public static void main(String[] args) {
        int level = 3;
        int childNumber = 2;
        int total = calNodes(level, childNumber);
        printTree(total, childNumber);
    }

}
